package com.zhiyou100.service;

import com.zhiyou100.mapper.CustomerMapper;
import com.zhiyou100.model.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CustomerService {
    @Autowired
    CustomerMapper customerMapper;
    public List<Customer> listCustomer(Map map) {
        System.out.println("CustomerService关键词："+map);
        List<Customer> Customers =  customerMapper.listCustomer(map);
        return Customers;

    }

    public int addCustomer(Customer Customer) {
       int  i  =  customerMapper.addCustomer(Customer);
       return i;
    }

    public int updateCustomer(Customer Customer) {
        int  i  =  customerMapper.updateCustomer(Customer);
        return i;
    }

    public Customer lookCustomer(int id) {
        Customer Customer =  customerMapper.lookCustomer(id);
        return Customer;
    }

    public int deleteAll(List<Integer> CustomerIds) {
      int i =   customerMapper.deleteAll(CustomerIds);
      return i;
    }

    public int delete(int id) {
       int i =  customerMapper.delete(id);
       return  i;
    }

    public Customer findCustomerById(int orderCustomerId) {
        Customer Customer =   customerMapper.findCustomerById(orderCustomerId);
        return Customer;
    }

    public int findCustomerByIDCard(String idcard) {
       int id =  customerMapper.findCustomerByIDCard(idcard);
       return id;
    }

    public int updateCustomerEndTime(String customerEndtime, int cid) {
        int id =  customerMapper.updateCustomerEndTime( customerEndtime,  cid);
        return id;
    }
}
